package com.xmtlxx.wms.mapper;

import com.xmtlxx.common.annotation.DataColumn;
import com.xmtlxx.common.annotation.DataPermission;
import com.xmtlxx.common.core.mapper.BaseMapperPlus;
import com.xmtlxx.wms.domain.StoreArea;
import com.xmtlxx.wms.domain.bo.StoreAreaBo;
import com.xmtlxx.wms.domain.vo.StoreAreaVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 库区Mapper接口
 *
 * @author xmtlxx
 * @date 2022-08-15
 */
public interface StoreAreaMapper extends BaseMapperPlus<StoreAreaMapper, StoreArea, StoreAreaVo> {
    /**
     * 根据条件分页查询库区
     *
     * @param storeArea 库区
     * @return Page StoreArea
     */
//    @DataPermission({
//        @DataColumn(key = "tenantName", value = "s.create_by"),
//        @DataColumn(key = "deptName", value = "st.dept_id"),
//        @DataColumn(key = "userName", value = "s.create_by")
//    })
    Page<StoreAreaVo> selectPageStoreAreaList(@Param("page") Page<StoreArea> page,@Param("storeArea") StoreAreaBo storeArea);

    /**
     * 查询库区列表
     *
     * @param storeArea 库区
     * @return 库区集合
     */
    @DataPermission({
        @DataColumn(key = "tenantName", value = "s.create_by"),
        @DataColumn(key = "deptName", value = "st.dept_id"),
        @DataColumn(key = "userName", value = "s.create_by")
    })
    List<StoreAreaVo> selectStoreAreaList(@Param("storeArea") StoreAreaBo storeArea);

    StoreAreaVo selectStoreAreaVoByID(String id);

    int updateStoreAreaChildren(@Param("storeArea") List<StoreArea> storeAreas);
}
